from django.http import JsonResponse
from django.test import TestCase

# Create your tests here.
from cov.models import *


def test(request):
    # 获取所有城市
    cov_all = Cov.objects.all()
    print(cov_all)
    list1 = []

    for i in cov_all:
        dict1 = {}
        city = i.city
        confirm = i.confirm
        dict1[city] = confirm
        list1.append(dict1)
    print(list1)
    # [{'地区待确认市': 308175}, {'长春市': 23132}] 得到类似数据

    return JsonResponse({"msg": "ok"})
